package com.itzh.singleton.lazy;

public class LazyThree {

    private static boolean initalized = false;

    private LazyThree(){
        synchronized (LazyThree.class) {
            if (initalized == false) {
                initalized = !initalized;
            } else {
                throw new RuntimeException("单例已被侵犯");
            }
        }
    }

    public static final LazyThree getInstance(){
        return LazyHolder.LAZY;
    }

    private static class LazyHolder{
        private static final LazyThree LAZY = new LazyThree();
    }

}

